let fs = require('fs')

var Mock = require('mockjs')
const path = require('path')
let data= Mock.mock({
    "user|50":[{
        "id|+1":1000,
        "name":'@cname',
        "email":"@email",
        "child|10":[{
            "partOf":"user",
            "id|+1":10,
            "name":"@cname"
        }]
    }]
})

fs.writeFile(path.join(__dirname,'data.json'),JSON.stringify(data),{encoding:'utf8'},(err)=>{
    if (err) {
        return err
    }
    console.log('写入成功',`一共${data.user.length}条数据`);
})